package com.ansion.baseui.base;

import android.app.Activity;
import android.widget.Toast;

import androidx.annotation.StringRes;

import com.ansion.utils.ResourceUtils;

/**
 * created by zhaoyuntao
 * on 21/07/2022
 * description:
 */
public interface ToastSupport {
    default void showToast(@StringRes int messageRes) {
        showToast(ResourceUtils.getString(messageRes));
    }

    default void showToast(String message) {
        Toast.makeText(activity(), message, Toast.LENGTH_SHORT).show();
    }

    default void showToastWarning(@StringRes int messageRes) {
        Toast.makeText(activity(), ResourceUtils.getString(messageRes), Toast.LENGTH_SHORT).show();
    }

    default void showToastSuccess(@StringRes int messageRes) {
        showToastSuccess(ResourceUtils.getString(messageRes));
    }

    default void showToastSuccess(String message) {
        Toast.makeText(activity(), message, Toast.LENGTH_SHORT).show();
    }

    Activity activity();
}
